#!/bin/bash

# 获取所有正在运行的容器ID
containers=$(docker ps -q)

# 遍历每个容器并检查其RestartPolicy
for container in $containers; do
    name=$(docker inspect --format '{{.Name}}' $container)
    restart_policy=$(docker inspect --format '{{.HostConfig.RestartPolicy.Name}}' $container)
    echo "Container ID: $container"
    echo "Container Name: $name"
    echo "Restart Policy: $restart_policy"
    echo "----------------------------------------"
done